﻿using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using DBConnectionLib;

namespace DBSourceToolsLib.Commands
{
    public class DatabaseCommand //: Interfaces.IDatabaseCommand
    {
//        private Form m_ParentForm;
//        private DatabaseCommandTypes m_DatabaseCommandType;
//        public DatabaseCommand(Form oForm, DatabaseCommandTypes oDatabaseCommandType)
//        {
//            this.m_ParentForm = oForm;
//            this.m_DatabaseCommandType = oDatabaseCommandType;
//        }
//        //string "test";
//        #region IDatabaseCommand Members

//        public void Execute(ref DatabaseEx oDatabase, bool bWriteData)
//        {
//            //SysObjects.SysObjects oSysObjects;
//            //if (oDatabase.SysObjects == null) 
//            //    oSysObjects = new DBSourceToolsLib.SysObjects.SysObjects(oDatabase, oDatabase.BaseDirectory);
//            //else 
//            //    oSysObjects = oDatabase.SysObjects;

//            switch (m_DatabaseCommandType)
//            {
//                case DatabaseCommandTypes.LoadFromDatabase:
//                case DatabaseCommandTypes.LoadFromDisk:
//                case DatabaseCommandTypes.WriteToDisk:
//                    {
//                        UI.Forms.ProgressForm progressForm = new DBSourceToolsLib.UI.Forms.ProgressForm();
//                        oDatabase.SysObjects.SetDBCommandType(this.m_DatabaseCommandType);
//                        progressForm.setEventSource(oDatabase.SysObjects);
//                        progressForm.ShowDialog(m_ParentForm);
//                    }
//                    break;
//                case DatabaseCommandTypes.WriteToDiskNoData:
//                    {
//                        UI.Forms.ProgressForm progressForm = new DBSourceToolsLib.UI.Forms.ProgressForm();
//                        oDatabase.SysObjects.SetDBCommandType(this.m_DatabaseCommandType);
//                        progressForm.setEventSource(oDatabase.SysObjects);
//                        progressForm.ShowDialog(m_ParentForm);
//                    }
//                    break;
//                case DatabaseCommandTypes.NewQuery:
//                    oDatabase.SysObjects.NewQuery();
                    
//                    break;
//                case DatabaseCommandTypes.LoadTableList:
//                    {
//                        UI.Forms.ProgressForm progressForm = new DBSourceToolsLib.UI.Forms.ProgressForm();
//                        oDatabase.SysObjects.SetDBCommandType(this.m_DatabaseCommandType);
//                        progressForm.setEventSource(oDatabase.SysObjects);
//                        progressForm.ShowDialog(m_ParentForm);
//                    }
//                    break;
//                case DatabaseCommandTypes.LoadStoredProcList:
//                    {
//                        UI.Forms.ProgressForm progressForm = new DBSourceToolsLib.UI.Forms.ProgressForm();
//                        oDatabase.SysObjects.SetDBCommandType(this.m_DatabaseCommandType);
//                        progressForm.setEventSource(oDatabase.SysObjects);
//                        progressForm.ShowDialog(m_ParentForm);
//                    }
//                    break;
//                case DatabaseCommandTypes.LoadViewList:
//                    {
//                        UI.Forms.ProgressForm progressForm = new DBSourceToolsLib.UI.Forms.ProgressForm();
//                        oDatabase.SysObjects.SetDBCommandType(this.m_DatabaseCommandType);
//                        progressForm.setEventSource(oDatabase.SysObjects);
//                        progressForm.ShowDialog(m_ParentForm);
//                    }
//                    break;
//                case DatabaseCommandTypes.LoadUserList:
//                    {
//                        UI.Forms.ProgressForm progressForm = new DBSourceToolsLib.UI.Forms.ProgressForm();
//                        oDatabase.SysObjects.SetDBCommandType(this.m_DatabaseCommandType);
//                        progressForm.setEventSource(oDatabase.SysObjects);
//                        progressForm.ShowDialog(m_ParentForm);
//                    }
//                    break;

//            }
////            oDatabase.SysObjects = oSysObjects;

//        }

//        #endregion
    }
}
